const router = require('@koa/router')({prefix: '/school'})
const { validator, validatorClass } = require('@/middleware/school')
const {
  studentList,
  insertStudent,
  teacherList, 
  teacherToCourseList, 
  studentScore,
  maxScore,
  menuRList,
  menuList,
  insertMenu,
  delMenu,
  editMenu,
  sdept,
  addSdept,
  editSdept,
  delSdept,
  classs,
  addClass,
  editClass,
  delClass,
  studentCourse,
  insertStudentCourse,
  roleList,
  addRole,
  delRole,
  courseList,
  addCourse,
  editCourse,
  delCourse,
  editMenuRole,
  addTeacherCourse,
  editTeacherCourse,
  delTeacherCourse,
  getSdeptToCourse,
  editSdeptToCourse
} = require('./controller')

router.get('/menuRList', menuRList)
router.post('/menuRList', editMenuRole)
router.get('/menuList', menuList)
router.post('/menuList', insertMenu)
router.del('/menuList', delMenu)
router.put('/menuList', editMenu)
router.get('/course', courseList)
router.post('/course', addCourse)
router.put('/course', editCourse)
router.del('/course', delCourse)
router.get('/role', roleList)
router.post('/role', addRole)
router.del('/role', delRole)
router.get('/studentList', studentList)
router.post('/insertStudent', insertStudent)
router.get('/teacherList', teacherList)
router.get('/teacherToCourseList', teacherToCourseList)
router.post('/teacherToCourseList', addTeacherCourse)
router.put('/teacherToCourseList', editTeacherCourse)
router.del('/teacherToCourseList', delTeacherCourse)
router.get('/studentScore', studentScore)
router.get('/maxScore', maxScore)
router.get('/sdept', sdept)
router.post('/addSdept', validator, addSdept)
router.put('/editSdept', validator, editSdept)
router.del('/delSdept', delSdept)
router.get('/class', classs)
router.post('/class', validatorClass, addClass)
router.put('/class', validatorClass, editClass)
router.del('/class', delClass)
router.get('/studentCourse', studentCourse)
router.post('/studentCourse', insertStudentCourse)
router.get('/sdeptToCourse', getSdeptToCourse)
router.post('/sdeptToCourse', editSdeptToCourse)

module.exports = router.routes()